home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / windows / winxs16.zip / DIFF-E.SED < prev    next >
Text File  |  1995-11-27  |  633b  |  59 lines

  1. #n
  2.  
  3. # script to simulate the diff -e command, whereby
  4. # WinXs diff ouput is converted to a sed script.
  5. # When applied to file1, this script will produce
  6. # file2.
  7.  
  8. # delete lines referring to file1
  9.  
  10. :begin
  11. /^----/d
  12. /^< /d
  13.  
  14. # pass through blank lines
  15.  
  16. /^$/{
  17.     p
  18.     d
  19. }
  20.  
  21. # convert sequences from file2
  22.  
  23. /^> /{
  24.     s/^> //
  25.     x
  26. :loop
  27.     n
  28.     s/^> //
  29.     t repeat
  30.     x
  31.     p
  32.     x
  33.     b begin
  34. :repeat
  35.     x
  36.     s/$/\\/
  37.     p
  38.     b loop
  39. }
  40.  
  41. # convert command lines
  42.  
  43. /a/{
  44.     s/a.*$/a\\/
  45.     s/^0a/1i/
  46.     p
  47.     d
  48. }
  49.  
  50. /c/{
  51.     s/c.*$/c\\/p
  52.     d
  53. }
  54.  
  55. /d/{
  56.     s/d.*$/d/p
  57.     d
  58. }
  59.